<?
function verify($time){
    define(SEC_KEY,'7d9d6op56gdg1524h3b8');
    return md5($time.SEC_KEY);
}

/*
 * $time date 开始时间
 * $sid int 会员ID 如果是1 则不做限制
 * $zhixiashi bool 是否显示出直辖市和省份的数据 传入false可以减少计算量
 * $etime date 结束时间 不传默认昨天
 * */
function post_curl($time,$sid,$zhixiashi=true,$etime='',$action='map',$line_type='',$tid='',$is_apply=false,$lid='',$dtype=null,$salerid=''){
    $url = "http://s.12301.cc/pft/uchat/other/order_everyDay.php";
    //query带三个参数 请求查看数据的日期 会员id 参与加密的当前时间 加密后的乱码
//    $sale_prod = '';
    /*
    if($action == 'line' || $action == 'all'){
        include '/var/www/html/new/d/class/Member.php';
        $s = new SoapClient(null,array(
                "location" => "http://localhost/open/openService/pft_insideMX.php",
                "uri" => "www.16u.com?ac_16u=16ucom|pw_16u=c33367701511b4f6020ec61ded352059|auth_16u=true")
        );
        $m        = new Member($s, $sid);
        $sale_prod = $m->salePros(null);
        $sale_prod = json_encode($sale_prod);
    }
    */
    $query =array(
        'btime'=> $time,//开始时间
        'etime'=> $etime,//结束时间
        'sid'   => $sid,//帐号
        'time_2'=> $_SERVER['REQUEST_TIME'],//验证用的时间
        'token' => verify($_SERVER['REQUEST_TIME']),
        'zhixiashi' => $zhixiashi,//是否把直辖市的数据写入旗下的每个县
        'action'=>$action,//line pie map all
        'line_type'=>$line_type,//折线图取门票数tnum 还是 金额money
        'tid'=>$tid,//要查询的景区下面的所有tid 用','隔开
        'is_apply'=>$is_apply,//是否是供应商
        'lid'=>$lid,//景区ID
        'dtype'=>$dtype,
        'salerid'=>$salerid,
//        'sale_prod'=>$sale_prod,
    );
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_HEADER, true);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_HEADER, 0);
    curl_setopt($ch, CURLOPT_POST, true );
    curl_setopt($ch, CURLOPT_POSTFIELDS, $query);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
    curl_setopt($ch, CURLOPT_SSLVERSION, 1);
    $rew = curl_exec($ch);
//    $errno = curl_errno($ch);
    return $rew;
}
?>